package com.example.textview;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TimePicker;

import com.example.textview.util.ToastUtil;
import com.example.textview.widget.CustomDialog;

public class CustomDialgActivity extends AppCompatActivity {


    final int[] h = {8};
    final int[] s = {0};
    Button mbtn_custom;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_custom_dialg);

        mbtn_custom=findViewById(R.id.btn_custom);
        mbtn_custom.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                CustomDialog customDialog=new CustomDialog(CustomDialgActivity.this);

                customDialog.setTitle("ZHUYI");
                customDialog.setMsg("hello world");

                customDialog.setCancel("取消", new CustomDialog.IOnCancelListener() {
                    @Override
                    public void onCancel(CustomDialog customDialog) {
                        ToastUtil.showMsg(CustomDialgActivity.this,"取消");
                    }
                });


                customDialog.setConfim("OK", new CustomDialog.IOnConfimListener() {
                    @Override
                    public void onCancel(CustomDialog customDialog) {
                      //  ToastUtil.showMsg(CustomDialgActivity.this,"hour:"+h+"secend:"+s);

                        ToastUtil.showMsg(CustomDialgActivity.this,"hour:"+h[0]+"secend:"+s[0]);
                    }
                });


                customDialog.setTimeChangedListener(new CustomDialog.IOnTimeChangedListener() {
                    @Override
                    public void onTimeChange(TimePicker timePicker, int hour, int secend) {
                        h[0]=hour;
                        s[0]=secend;

                      //  ToastUtil.showMsg(CustomDialgActivity.this,"hour:"+);
                    }
                });

                customDialog.show();
            }
        });
    }
}